package com.river.springbootdemo.leecode;

import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.Arrays;
import java.util.List;

/**
 * 判断一个整数是否是回文数。回文数是指正序（从左向右）和倒序（从右向左）读都是一样的整数。
 * @Author cxy
 */
public class Palindrome {
    public static boolean isPalindrome1(int x) {
        String val1=x+"";
        char[] chars = val1.toCharArray();
        char[] chars1=new char[chars.length];
        int o=0;
        for (int i=chars.length-1;i>=0;i--){
            chars1[o]=chars[i];
            o++;
        }
        for (int j=0;j<chars.length;j++){
            boolean b = chars[j] == chars1[j];
            if (!b){
                 return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println(isPalindrome1(6696966));
    }
}
